<!doctype html>

<html>

  <head>
    <meta charset="utf-8">
    <title>WASM test</title>
  </head>

  <body>
    <script>
      var importObject = {
        imports: {
          add: function(arg) {
            console.log(arg);
          }
        }
      };

      fetch('add.wasm').then(response =>
        response.arrayBuffer()
      ).then(bytes =>
        WebAssembly.instantiate(bytes, importObject)
      ).then(result =>
        console.log(result.instance.exports.add(1,2))
      );


    </script>
  </body>

</html>


